Operators of JavaScript
Author: Al-mamun Sarkar
Date: 2021-03-29 17:22:13
JavaScript has Arithmetic Operators, Assignment Operators, String Operators, Concatenation Operators, Comparison Operators, Logical Operators, Type Operators, and Bitwise Operators.
Arithmetic Operators :
Operator | Use |
---|---|
+ | Calculate Addition |
- | Calculate Subtraction |
* | Calculate Multiplication |
** | Calculate Exponentiation\ |
/ | Calculate Division |
% | Calculate Modulus (Remainder) |
++ | Increment value |
-- | Decrement value |
Assignment Operators:
Operator | Example | Same As |
---|---|---|
= | a = b | a = b |
+= | a += b | a = a + b |
-= | a -= b | a = a - b |
*= | a *= b | a = a * b |
/= | a /= b | a = a / b |
%= | a %= b | a = a % b |
**= | a **= b | a = a ** b |
Comparison Operators
Operator | Description |
---|---|
== | Compare equal to |
=== | Compare equal value and equal type |
!= | Compare not equal |
!== | Compare not equal value or not equal type |
> | Compare greater than |
< | Compare less than |
>= | Compare greater than or equal to |
<= | Compare less than or equal to |
? | ternary operator for condition |
Logical Operators
Operator | Description |
---|---|
&& | logical AND |
|| | logical OR |
! | logical NOT |
Type Operators
Operator | Description |
---|---|
typeof | Check the variable data type |
instanceof | Check Object type |
Concatenation Operators:
Operator | Description |
---|---|
+ | "Hello" + " World" |